import { lazyReportBatch } from '../export';
import { generateUniqueId } from '../utils';

/**
 * 页面访问
 */
const pv = () => {
  const reportData = {
    type: 'behavior',
    subType: 'pv',
    // 表示从页面加载开始到调用 performance.now() 方法时所经过的毫秒数
    startTime: performance.now(),
    pageUrl: window.location.href,
    referrer: document.referrer,
    uuid: generateUniqueId(),
  };
  lazyReportBatch(reportData);
};

export default pv;
